package cn.com.blueInfo.bpm.system.enums;

import cn.com.blueInfo.bpm.common.enums.BaseEnum;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 字典类型
 * @author suxch
 * @since 2025/8/28 22:11
 */
@Getter
@AllArgsConstructor
public enum DictType implements BaseEnum<Integer> {

    /** 字典类型-系统内置（不可修改） */
    SYSTEM_BUILT_IN(1, "系统内置（不可修改）"),
    /** 字典类型-业务自定义（可编辑） */
    BUSINESS_CUSTOMIZABLE(2, "业务自定义（可编辑）");

    @EnumValue
    private final Integer code;

    @JsonValue
    private final String desc;

    public static DictType getByCode(Integer code) {
        return BaseEnum.getByCode(DictType.class, code);
    }

    @JsonCreator
    public static DictType getByName(String name) {
        return BaseEnum.getByName(name, DictType.class);
    }

}
